package com.icw.resource.workflow.entity;

import javax.persistence.*;
import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;
import com.icw.basis.BasePoEntity;

import static com.icw.configuration.ConstSettings.*;
import lombok.*;

@Getter
@Setter
@Entity
public class WorkRoute extends BasePoEntity {

	private static final long serialVersionUID = 1L;

	@Column(length = MEDIUM_LENGTH, nullable = false)
	private String name;

	@Column(columnDefinition = TEXT_COLUMN, nullable = false)
	private String targetCriteria;

	@Fetch(FetchMode.JOIN)
	@ManyToOne(cascade = CascadeType.REMOVE, fetch = FetchType.EAGER)
	@JoinColumn
	private WorkStateDefinition targetStateDefinition;

	@Column(columnDefinition = TEXT_COLUMN)
	private String comments;
}
